package main

import (
	"fmt"
	"math/rand"
	"time"
)

func main() {
	//计数

	var num_buffer int
	var single int
	var doubule uint64 = 1

	//创建生成器，并为其设定种子。
	r := rand.New(rand.NewSource(time.Now().UnixNano()))

	//生成20个随机数，奇数位相加，偶数位相乘
	for i := 1; i <= 20; i++ {
		num_buffer = r.Intn(20)
		for num_buffer == 0 {
			num_buffer = r.Intn(20)
		}

		if (i & 1) == 1 {
			single += num_buffer
		} else if (i & 1) == 0 {
			doubule *= uint64(num_buffer)
		} else {
			fmt.Printf("逻辑与运算公式错了吧～")
		}
		fmt.Printf("%+v,", num_buffer)
	}

	fmt.Printf("\n当前奇数位相加总和为：%d,偶数位相乘总和为：%v", single, doubule)

}
